<script setup="">
import { EchartsOptions } from "../../help/index.js";
import {nextTick, ref} from 'vue'
import * as echarts from 'echarts'
import Card from "../../help/Card.vue";

const id = ref(Math.random().toString(36).substring(2, 9))

const option = {
  tooltip: {

  },
  xAxis: {
    type: 'category',
    data: ['优','良','合格','不合格'],
  },
  yAxis: {
    axisLine: {
      show: false
    },
    axisTick: {
      show: false
    },
    axisLabel: {
      color: '#999'
    }
  },
  dataZoom: [
    {
      type: 'inside'
    }
  ],
  series: [
    {
      type: 'bar',
      barWidth: 30,
      showBackground: true,
      itemStyle: {
        color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [
          { offset: 0, color: '#83bff6' },
          { offset: 0.5, color: '#188df0' },
          { offset: 1, color: '#188df0' }
        ])
      },
      emphasis: {
        itemStyle: {
          color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [
            { offset: 0, color: '#2378f7' },
            { offset: 0.7, color: '#2378f7' },
            { offset: 1, color: '#83bff6' }
          ])
        }
      },
      data: [40,50,10,0]
    }
  ]
}

nextTick(() => {
  EchartsOptions(option, id.value)
})

</script>

<template>
  <Card class="flex flex-1 animate__animated animate__fadeInTopLeft" title="项目成绩比">
    <div class="w-full h-full" :id="id"/>
  </Card>
</template>
